import request from '@/utils/request'
const baseUrl = '/cz-truckfleet/api/v1/releaseCarSources' // 车队服务-- 发布车源
// import { carrierPage ,custPage,getCarInfo,submitSave,submitPublish,pitchDelete,onShelf,offShelf, statusCount} from '@/api/carList'

// ### 发布车源:放入已下架 放入车库(编辑增加id 传参)
// {
//   "departureCityId":1,
//   "departureCityName":"郑州",
//   "departureCountryId":1,
//   "departureCountryName":"中国",
//   "destinationCityId":"2",
//   "destinationCityName":"上海",
//   "destinationCountryId":"1",
//   "destinationCountryName":"中国",
//   "plateNumber":"豫A.666666",
//   "vehicleModel":5,
//   "vehicleLength":5,
//   "loadWeight":5,
//   "emissionStandard":5,
//   "freightPrice":-1,
//   "contacts":"张君宝",
//   "tel":"0371-12345678",
//   "groundingMethod":5,  //已删除
//   "remark": "备注",
//   "boxEastYardId": 4,
//   "mainFileList": "[{\"name\":\"20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\",\"originalFileName\":\"国际贸易供应链数字平台需求分析(1).docx\",\"url\":\"http://47.122.3.254:9000/default/20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\"}]",
//   "detailFileList": "[{\"name\":\"20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\",\"originalFileName\":\"国际贸易供应链数字平台需求分析(1).docx\",\"url\":\"http://47.122.3.254:9000/default/20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\"}]"
// }

export const inWarehouse = (data: any) => {
  return request({
    url: baseUrl+'/inWarehouse',
    method: 'POST',
    data: data
  })
}

/**
 * # 发布车源:车队查询分页列表
# POST {{baseUrl}}/releaseCarSources/carrierPage
# 过滤条件： 承运公司Id:carrierId  承运公司名称: carrierName  出发地城市Id:departureCityId  出发地城市名称: departureCityName 到达地城市Id:destinationCityId  到达地城市名称: destinationCityName
# 车牌号:plateNumber 车型:vehicleModel 5-标准 10-高板 15-平板 20-半挂车  车长:vehicleLength 5-(6-8米) 10-(9-10米) 15-(11-12米) 20-(13-15米) 25-(16-17.5米)
# 载重:loadWeight 5-(3-5吨) 10-(6-10吨) 15-(11-15吨) 20-(16-20吨) 25-(21-25吨) 30-(26-30吨) 35-(31-35吨)
# 排放标准:emissionStandard 5-国IV 10-国V 15-国VI
# 发布状态:status 5-出租中 10-仓库中 15-待发布
 
 */
export const carrierPage = (data: any) => {
  return request({
    url: baseUrl+'/carrierPage',
    method: 'post',
    data: data
  })
}

/**
 * # 发布车源:顾客查询分页列表
# POST {{baseUrl}}/releaseCarSources/page
# 过滤条件： 承运公司Id:carrierId  承运公司名称: carrierName  出发地城市Id:departureCityId  出发地城市名称: departureCityName 到达地城市Id:destinationCityId  到达地城市名称: destinationCityName
# 车牌号:plateNumber 车型:vehicleModel 5-标准 10-高板 15-平板 20-半挂车  车长:vehicleLength 5-(6-8米) 10-(9-10米) 15-(11-12米) 20-(13-15米) 25-(16-17.5米)
# 载重:loadWeight 5-(3-5吨) 10-(6-10吨) 15-(11-15吨) 20-(16-20吨) 25-(21-25吨) 30-(26-30吨) 35-(31-35吨)
# 排放标准:emissionStandard 5-国IV 10-国V 15-国VI
# 发布状态:status 5-出租中 10-仓库中 15-待发布
 */
export const custPage = (data: any) => {
  return request({
    url: baseUrl+'/page',
    method: 'post',
    data: data
  })
}


/**
 * 发布车源:获取详情
 * @param {id}
 */
export const getCarInfo = (id: any) => {
  return request({
    url: baseUrl+'/'+id,
    method: 'GET' 
  })
}

/**
 * 发布车源:保存待发布 
 *    # departureCityId:出发地城市Id
    # departureCityName:出发地城市名称
    # departureCountryId:出发地国家Id
    # departureCountryName:出发地国家名称
    # destinationCityId:到达地城市Id
    # destinationCityName:到达地城市名称
    # destinationCountryId:到达地国家Id
    # destinationCountryName:到达地国家名称
    # plateNumber:车牌号
    # vehicleModel:车型 5-标准 10-高板 15-平板 20-半挂车
    # vehicleLength:车长 5-(6-8米) 10-(9-10米) 15-(11-12米) 20-(13-15米) 25-(16-17.5米)
    # loadWeight:载重 5-(3-5吨) 10-(6-10吨) 15-(11-15吨) 20-(16-20吨) 25-(21-25吨) 30-(26-30吨) 35-(31-35吨)
    # emissionStandard:排放标准 5-国IV 10-国V 15-国VI
    # freightPrice:运价价格(-1 代表面议 其他的是真实价格)
    # contacts:联系人
    # tel:联系人电话
    # groundingMethod:上架方式 5-立即上架  10-放入仓库
    # mainFileList:主图
    # detailFileList:车主简介
    # 以上字段必填
    # remark:备注
 */
export const submitSave = (data: any) => {
  return request({
    url: baseUrl+'/tobeReleased',
    method: 'post',
    data: data
    // data:{
    // "departureCityId":1,
    // "departureCityName":"郑州",
    // "departureCountryId":1,
    // "departureCountryName":"中国",
    // "destinationCityId":"2",
    // "destinationCityName":"上海",
    // "destinationCountryId":"1",
    // "destinationCountryName":"中国",
    // "plateNumber":"豫A.666666",
    // "vehicleModel":5,
    // "vehicleLength":5,
    // "loadWeight":5,
    // "emissionStandard":5,
    // "freightPrice":-1,
    // "contacts":"张君宝",
    // "tel":"0371-12345678",
    // "groundingMethod":5,
    // "remark": "备注",
    // "boxEastYardId": 4,
    // "mainFileList": "[{\"name\":\"20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\",\"originalFileName\":\"国际贸易供应链数字平台需求分析(1).docx\",\"url\":\"http://47.122.3.254:9000/default/20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\"}]",
    // "detailFileList": "[{\"name\":\"20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\",\"originalFileName\":\"国际贸易供应链数字平台需求分析(1).docx\",\"url\":\"http://47.122.3.254:9000/default/20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\"}]"
    // }
  })
}

/**
 * 发布车源:提交发布
 # departureCityId:出发地城市Id
    # departureCityName:出发地城市名称
    # departureCountryId:出发地国家Id
    # departureCountryName:出发地国家名称
    # destinationCityId:到达地城市Id
    # destinationCityName:到达地城市名称
    # destinationCountryId:到达地国家Id
    # destinationCountryName:到达地国家名称
    # plateNumber:车牌号
    # vehicleModel:车型 5-标准 10-高板 15-平板 20-半挂车
    # vehicleLength:车长 5-(6-8米) 10-(9-10米) 15-(11-12米) 20-(13-15米) 25-(16-17.5米)
    # loadWeight:载重 5-(3-5吨) 10-(6-10吨) 15-(11-15吨) 20-(16-20吨) 25-(21-25吨) 30-(26-30吨) 35-(31-35吨)
    # emissionStandard:排放标准 5-国IV 10-国V 15-国VI
    # freightPrice:运价价格(-1 代表面议 其他的是真实价格)
    # contacts:联系人
    # tel:联系人电话
    # groundingMethod:上架方式 5-立即上架  10-放入仓库
    # mainFileList:主图
    # detailFileList:车主简介
    # 以上字段必填
    # remark:备注
 */
export const submitPublish = (data: any) => {
  return request({
    url: baseUrl+'/submit',
    method: 'post',
    data: data
    // data:{
    // "departureCityId":1,
    // "departureCityName":"郑州",
    // "departureCountryId":1,
    // "departureCountryName":"中国",
    // "destinationCityId":"2",
    // "destinationCityName":"上海",
    // "destinationCountryId":"1",
    // "destinationCountryName":"中国",
    // "plateNumber":"豫A.666666",
    // "vehicleModel":5,
    // "vehicleLength":5,
    // "loadWeight":5,
    // "emissionStandard":5,
    // "freightPrice":-1,
    // "contacts":"张君宝",
    // "tel":"0371-12345678",
    // "groundingMethod":5,
    // "remark": "备注",
    // "boxEastYardId": 4,
    // "mainFileList": "[{\"name\":\"20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\",\"originalFileName\":\"国际贸易供应链数字平台需求分析(1).docx\",\"url\":\"http://47.122.3.254:9000/default/20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\"}]",
    // "detailFileList": "[{\"name\":\"20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\",\"originalFileName\":\"国际贸易供应链数字平台需求分析(1).docx\",\"url\":\"http://47.122.3.254:9000/default/20240612/cddd81a833c64a7eab1da5c0aef8dfaf.docx\"}]"
    // }
  })
}

/**
 * 发布车源:批量删除
 * @param data id [1,2] 车源的Id
 */
export const pitchDelete = (data: any) => {
  return request({
    url: baseUrl,
    method: 'DELETE',
    data: data
  })
}

/**
 * 发布车源:批量上架
 * @param data id [1,2] 车源的Id
 */
export const onShelf = (data: any) => {
  return request({
    url: baseUrl+'/onShelf',
    method: 'PUT',
    data: data
  })
}

/**
 * 发布车源:批量下架
 * @param data id [1,2] 车源的Id
 */
export const offShelf = (data: any) => {
  return request({
    url: baseUrl+'/offShelf',
    method: 'PUT',
    data: data
  })
}

// 发布车源:状态统计
export const statusCount = (data:any) => {
  return request({
    url: baseUrl+'/statusCount',
    method: 'post',
    data: data
  })
}